﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Navigation.aspx.cs" Inherits="Myproject.BSM.PcWeb.PcBase.Navigation" %>

<div class="bjui-pageHeader">
    <form id="pc_base_nav_form" data-toggle="ajaxsearch" action="/bsm/pcweb/PcBase/Navigation.aspx" method="post">
        <div class="bjui-searchBar">
            <ul class="breadcrumb">
                <li><a><i class="fa fa-university"></i>后台管理中心</a></li>
                <li><a><i class="fa fa-desktop"></i>电脑端管理</a></li>
                <li class="active"><a><i class="fa fa-map-signs"></i>导航信息</a></li>
            </ul>
        </div>
        <div class="bjui-searchBar">
            <a class="btn btn-orange" href="javascript:;" data-toggle="reloadsearch" data-clear-query="true" data-icon="undo">刷新</a>
            <a class="btn btn-green" href="/bsm/pcweb/PcBase/NavigationEdit.aspx?pid=0" data-toggle="dialog" data-width="600" data-height="300" data-id="pc_base_navedit" data-icon="plus">添加主导航</a>
        </div>
    </form>

</div>
<div class="bjui-pageContent">
    <table class="table table-bordered table-hover table-striped table-top" data-selected-multi="true" style="text-align: center;">
        <%--<caption>...</caption>--%>
        <thead>
            <tr>
                <th style="text-align: center;">中文导航
                </th>
                <th style="text-align: center;">英文导航
                </th>
                <th style="text-align: center;">中文链接
                </th>
                <th style="text-align: center;">英文链接
                </th>
                <th style="text-align: center;">主排序
                </th>
                <th style="text-align: center;">子排序
                </th>
                <th style="text-align: center;">操作
                </th>
            </tr>
        </thead>
        <tbody>
            <%if (MessageTable != null && MessageTable.Rows.Count > 0)
              {
                  foreach (System.Data.DataRow row in MessageTable.Rows)
                  {
                        
            %><tr>
                <td style="padding-left: 30px; text-align: left;"><a><%= row["Title"] %></a></td>
                <td style="padding-left: 30px; text-align: left;"><a><%= row["ETitle"] %></a></td>
                <td style="text-align: left;"><span class="label label-success"><%= row["Url"] %></span></td>
                <td style="text-align: left;"><span class="label label-success"><%= row["EUrl"] %></span></td>
                <td>
                    <a class="btn btn-green" href="/bsm/ashx/PcBase/NavigationAjax.ashx?dos=rank&id=<%= row["NavID"] %>&rank=1" data-toggle="doajax"><i class="fa fa-arrow-down"></i></a>
                    <span class="label label-info"><%= row["FatherRank"] %></span>
                    <a class="btn btn-green" href="/bsm/ashx/PcBase/NavigationAjax.ashx?dos=rank&id=<%= row["NavID"] %>&rank=-1" data-toggle="doajax"><i class="fa fa-arrow-up"></i></a>
                </td>
                <td></td>
                <td>
                    <a class="btn btn-green" href="/bsm/pcweb/PcBase/NavigationEdit.aspx?pid=<%= row["NavID"] %>" data-toggle="dialog" data-width="600" data-height="300" data-id="pc_base_navedit" data-title="新增子导航">新增子导航</a>
                    <a class="btn btn-green" href="/bsm/pcweb/PcBase/NavigationEdit.aspx?id=<%= row["NavID"] %>" data-toggle="dialog" data-width="600" data-height="300" data-id="pc_base_navedit" data-title="修改导航">修改</a>
                    <a href="/bsm/ashx/PcBase/NavigationAjax.ashx?dos=delete&id=<%= row["NavID"] %>" class="btn btn-red" data-toggle="doajax" data-confirm-msg="确定要删除该行信息吗？">删除</a>
                </td>
            </tr>
            <%
                      System.Data.DataRow[] rows = MessageTable2.Select(" ParentID = '" + row["NavID"].ToString() + "' ", "sonrank");
                      if (rows.Length > 0)
                      {
                          foreach (System.Data.DataRow row2 in rows)
                          {
                        
            %><tr>
                <td style="padding-left: 50px; text-align: left;">|__ <a><%= row2["Title"] %></a></td>
                <td style="padding-left: 50px; text-align: left;">|__ <a><%= row2["ETitle"] %></a></td>
                <td style="text-align: left;"><span class="label label-success"><%= row2["Url"] %></span></td>
                <td style="text-align: left;"><span class="label label-success"><%= row2["EUrl"] %></span></td>
                <td></td>
                <td>
                    <a class="btn btn-green" href="/bsm/ashx/PcBase/NavigationAjax.ashx?dos=rank2&id=<%= row2["NavID"] %>&rank=1" data-toggle="doajax"><i class="fa fa-arrow-down"></i></a>
                    <span class="label label-info"><%= row2["SonRank"] %></span>
                    <a class="btn btn-green" href="/bsm/ashx/PcBase/NavigationAjax.ashx?dos=rank2&id=<%= row2["NavID"] %>&rank=-1" data-toggle="doajax"><i class="fa fa-arrow-up"></i></a>
                </td>
                <td>
                    <a class="btn btn-green" href="/bsm/pcweb/PcBase/NavigationEdit.aspx?id=<%= row2["NavID"] %>" data-toggle="dialog" data-width="600" data-height="300" data-id="pc_base_navedit" data-title="修改导航">修改</a>
                    <a href="/bsm/ashx/PcBase/NavigationAjax.ashx?dos=delete&id=<%= row2["NavID"] %>" class="btn btn-red" data-toggle="doajax" data-confirm-msg="确定要删除该行信息吗？">删除</a>
                </td>
            </tr>
            <%
                          }
                      }

                  }
              }%>
        </tbody>
    </table>
</div>
<div class="bjui-pageFooter">
</div>
<script>

    function pc_base_nav_js_delete(id) {
        $(this).alertmsg('confirm', '确定要删除该导航吗?', {
            okCall: function () {
                $.ajax({
                    type: "post",
                    url: "/bsm/ashx/PcBase/NavigationDelete.ashx?id=" + id,
                    dataType: "json",
                    beforeSend: function (XMLHttpRequest) {

                    },
                    success: function (data) {
                        if (data.IsError) {
                            $(this).alertmsg('correct', data.Message);
                            $(this).navtab('refresh', 'pc_base_Navigation');
                        }
                        else {
                            $(this).alertmsg('error', data.Message);
                        }
                    },
                    error: function () {
                        $(this).alertmsg('error', '删除失败，请稍后再试！');
                    }
                });
            }
        });
    }


    function pc_base_nav_js_rank(id, rank) {

        $.ajax({
            type: "post",
            url: "/bsm/ashx/PcBase/NavigationRank.ashx?id=" + id + "&rank=" + rank,
            dataType: "json",
            beforeSend: function (XMLHttpRequest) {

            },
            success: function (data) {
                if (data.IsError) {
                    //$(this).alertmsg('correct', data.Message);
                    $(this).navtab('refresh', 'pc_base_Navigation');
                }
                else {
                    $(this).alertmsg('error', data.Message);
                }
            },
            error: function () {
                $(this).alertmsg('error', '操作失败，请稍后再试！');
            }
        });
    }

    //修改子权重
    function pc_base_nav_js_rank2(id, rank) {

        $.ajax({
            type: "post",
            url: "/bsm/ashx/PcBase/NavigationRank2.ashx?id=" + id + "&rank=" + rank,
            dataType: "json",
            beforeSend: function (XMLHttpRequest) {

            },
            success: function (data) {
                if (data.IsError) {
                    //$(this).alertmsg('correct', data.Message);
                    $(this).navtab('refresh', 'pc_base_Navigation');
                }
                else {
                    $(this).alertmsg('error', data.Message);
                }
            },
            error: function () {
                $(this).alertmsg('error', '操作失败，请稍后再试！');
            }
        });
    }
</script>
